\documentclass[graybox,envcountchap,sectrefs]{svmono}

\usepackage[scaled=0.92,varqu]{inconsolata}

\usepackage{float}
\usepackage{index}
% index functions separately
\newindex{code}{adx}{and}{R code index}
\newcommand{\indexf}[1]{\index[code]{#1@\texttt{#1()}}}
\newcommand{\indexc}[1]{\index[code]{#1@\texttt{#1}}}

% Taken from pandoc x.md -o test.tex --standalone
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
\newenvironment{Shaded}{}{}
\newcommand{\KeywordTok} [1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}
\newcommand{\DecValTok}  [1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
\newcommand{\BaseNTok}   [1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
\newcommand{\FloatTok}   [1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
\newcommand{\CharTok}    [1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
\newcommand{\StringTok}  [1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
\newcommand{\CommentTok} [1]{\textcolor[rgb]{0.38,0.63,0.69}{{#1}}}
\newcommand{\OtherTok}   [1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
\newcommand{\AlertTok}   [1]{\textcolor[rgb]{1.00,0.00,0.00}{{#1}}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}
\newcommand{\ErrorTok}   [1]{\textcolor[rgb]{1.00,0.00,0.00}{{#1}}}
\newcommand{\NormalTok}  [1]{{#1}}

\newcommand{\OperatorTok}  [1]{{#1}}
\newcommand{\ControlFlowTok}  [1]{{#1}}
%
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{graphicx}
\DeclareGraphicsExtensions{.pdf,.png}
\providecommand{\tightlist}{\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}

\usepackage[hyphens]{url}
\usepackage{hyperref}

% Place links in parens
\renewcommand{\href}[2]{#2 (\url{#1})}
% Use auto ref for internal links
\let\oldhyperlink=\hyperlink
\renewcommand{\hyperlink}[2]{\autoref{#1}}
\def\chapterautorefname{Chapter}
\def\sectionautorefname{Section}
\def\subsectionautorefname{Section}
\def\subsubsectionautorefname{Section}

\setlength{\emergencystretch}{3em}  % prevent overfull lines
\vbadness=10000 % suppress underfull \vbox
\hbadness=10000 % suppress underfull \vbox
\hfuzz=10pt

\makeindex
\title{ggplot2}
\subtitle{Elegant Graphics for Data Analysis}
\author{Hadley Wickham}

\begin{document}

\frontmatter
\maketitle

\begin{dedication}
To my parents, Alison \& Brian Wickham. Without them, and their unconditional
love and support, none of this would have been possible.
\end{dedication}

\include{preface}

\tableofcontents

\mainmatter

\part{Getting started}

\include{introduction}
\include{ggplot}
\include{toolbox}

\part{The Grammar}

\include{mastery}
\include{layers}
\include{scales}
\include{position}
\include{themes}

\part{Data analysis}

\include{tidy-data}
\include{data-manip}
\include{modelling}
\include{programming}

\backmatter

\let\hyperlink=\oldhyperlink % Restore old hyperlink behaviour
\cleardoublepage
\markboth{Index}{Index}
\addcontentsline{toc}{chapter}{Index}
\printindex

\addcontentsline{toc}{chapter}{Code index}
\printindex[code]

\end{document}
